[NSCustomView isOpaque]: message sent to deallocated instance 0x123456

Posted by JxXx on Stack Overflow See other posts from Stack Overflow or by JxXx
Published on 2010-06-18T08:08:55Z Indexed on 2010/06/18 8:13 UTC
Read the original article Hit count: 350

Hi all

I receive that message in debugger console since I added the following arguments for debugging my application with XCode.

NSZombieEnabled: YES NSZombieLevel: 16

I was looking for zombie objects... Before doing so, the application failed before I could know where what and why was happening.... Now I´m pretty sure that 'something' outside code is trying to access an object previously released and I can't know where or why it happens neither where it was released...

My application is based on this proof of concept (very interesting and colorful) of QuartzCore Framework:

http://www.cimgf.com/2008/03/03/core-animation-tutorial-wizard-dialog-with-transitions/

Based on it, I added a few more nsviews to my project and a title and an index to each one, also I added some buttons, text and images depending on what 'dialog' (ACLinkedView object) it was...

The transition from an ACLinkedView object to another is going through a validation that depends on the view where you are ...

As you see I used this proof of concept as the foundation of my application and it grew and grew into an application that makes use of configuration files, web services (using gSOAP and C ...)

I hope you can give me some clues to where is my error ... I´ve been the hole week debugging unsuccessfully, as I said before, I think that that message comes from a point outside my code. I'd say that the problem s related with bad memory allocation or automatisms (nearly completely unknowns for me) during loading the nib components...

I will try to explain all this with parts of mycode.

This is my ACLinkedView definition:

#import <Cocoa/Cocoa.h>


@interface ACLinkedView : NSView
{
    // The Window (to close it if needed)
    IBOutlet NSWindow *mainWindow;

    // Linked Views
    IBOutlet ACLinkedView *previousView;
    IBOutlet ACLinkedView *nextView;

    // Buttons      
    IBOutlet NSButton *previousButton;
    IBOutlet NSButton *nextButton;  
    IBOutlet NSButton *helpButton; //It has to be a Button!!    
    IBOutlet NSImageView *bannerImg;    

    NSString *sName;
    int iPosition;
}


- (void) SetName: (NSString*) Name;
- (void) SetPosition: (int) Position;
- (NSString*) GetName;
- (int) GetPosition;
- (void) windowWillClose:(NSNotification*)aNotification;

@property (retain) NSWindow *mainWindow;
@property (retain) ACLinkedView *previousView, *nextView;
@property (retain) NSButton *previousButton, *nextButton, *helpButton;
@property (retain) NSImageView *bannerImg;  
@property (retain) NSString *sName; 


@end

The ACLinkedView's AwakeFromNib is this:

#import <Cocoa/Cocoa.h>


@interface ACLinkedView : NSView
{
    // The Window (to close it if needed)
    IBOutlet NSWindow *mainWindow;

    // Linked Views
    IBOutlet ACLinkedView *previousView;
    IBOutlet ACLinkedView *nextView;

    // Buttons      
    IBOutlet NSButton *previousButton;
    IBOutlet NSButton *nextButton;  
    IBOutlet NSButton *helpButton; //It has to be a Button!!    
    IBOutlet NSImageView *bannerImg;    

    NSString *sName;
    int iPosition;
}


- (void) SetName: (NSString*) Name;
- (void) SetPosition: (int) Position;
- (NSString*) GetName;
- (int) GetPosition;
- (void) windowWillClose:(NSNotification*)aNotification;

@property (retain) NSWindow *mainWindow;
@property (retain) ACLinkedView *previousView, *nextView;
@property (retain) NSButton *previousButton, *nextButton, *helpButton;
@property (retain) NSImageView *bannerImg;  
@property (retain) NSString *sName; 


@end

(As you can see the initialization of each ACLinkedView object depends on it's position wich is seted up into the Interface Builder by linking actions, buttons and CustomViews...

Does I explain enough? Do you think that I should put more of my code here, i.e. AppDelegate definition or it´s awakeFromNib method? Can you help me in any way?

Thanks in advance.

Juan

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nib